home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Viewers / aa_m68k_Intel_Only / ToyViewer1.2 / Source / hpcdtoppm.tproj / error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-14  |  6.3 KB  |  98 lines

  1. /* hpcdtoppm (Hadmut's pcdtoppm) v0.6
  2. *  Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
  3. *  Permission to use and distribute this software and its
  4. *  documentation for noncommercial use and without fee is hereby granted,
  5. *  provided that the above copyright notice appear in all copies and that
  6. *  both that copyright notice and this permission notice appear in
  7. *  supporting documentation. It is not allowed to sell this software in 
  8. *  any way. This software is not public domain.
  9. */
  10.  
  11. #include "hpcdtoppm.h"
  12. #define X(a,b) ((a == b) ? "->" : "  ")
  13.  
  14. void eerror(enum ERRORS e,char *file,int line)
  15.  {
  16.   
  17.   switch(e)
  18.    {case E_NONE:   return;
  19.     case E_IMP:    fprintf(stderr,"Sorry, Not yet implemented. [%s:%d]\n",file,line); break;
  20.     case E_READ:   fprintf(stderr,"Error while reading.\n"); break;
  21.     case E_WRITE:  fprintf(stderr,"Error while writing.\n"); break;
  22.     case E_INTERN: fprintf(stderr,"Internal error. [%s:%d]\n",file,line); break;
  23.     case E_ARG:    fprintf(stderr,"Error in Arguments !\n\n"); 
  24. #ifdef SHORT_HELP
  25.                    fprintf(stderr,"Usage: hpcdtoppm [options] pcd-file [ppm-file]\n");
  26.                    fprintf(stderr,"       ( - means stdin )\n");
  27.                    fprintf(stderr,"Opts:         [ -> = Default ] \n\n");
  28.                    fprintf(stderr,"   [-x] [-s] [-d] [-i] [-m]\n");
  29.                    fprintf(stderr,"   [-crop] [-pos] [-rep] [-vert] [-hori] [-S h v]\n");
  30.                    fprintf(stderr,"   [-n] [-r] [-l] [-h] [-a]\n");
  31.                    fprintf(stderr,"   [-ppm] [-pgm] [-ycc] [-ps] [-eps] [-psg] [-epsg] [-psd] [-epsd]\n");
  32.                    fprintf(stderr,"   [-pl f] [-pb f] [-pw f] [-ph f] [-dpi f] [-fak f]\n");
  33.                    fprintf(stderr,"   [-c0] [-c-] [-c+]\n");
  34.                    fprintf(stderr,"   [-0] [-C d s] [-1] [-2] [-3] [-4] [-5] [-6]\n");
  35.  
  36. #endif
  37. #ifdef LONG_HELP
  38.                    fprintf(stderr,"Usage: hpcdtoppm [options] pcd-file [ppm-file]\n");
  39.                    fprintf(stderr,"       ( - means stdin )\n");
  40.                    fprintf(stderr,"Opts:         [ -> = Default ] \n\n");
  41.  
  42.                    fprintf(stderr,"     -x     Overskip mode (tries to improve color quality.)\n");
  43.                    fprintf(stderr,"     -s     Apply simple sharpness-operator on the Luma-channel.\n");
  44.                    fprintf(stderr,"     -i     Give some (buggy) informations from fileheader.\n");
  45.                    fprintf(stderr,"     -m     Show the decoding steps to stderr.\n");
  46.                    fprintf(stderr,"     -crop  Try to cut off the black frame.\n");
  47.                    fprintf(stderr,"     -pos   Print file position of image to stderr.\n");
  48.                    fprintf(stderr,"     -rep   Try to jump over defects in the Huffman Code.\n");
  49.                    fprintf(stderr,"     -S h v Decode subrectangle with hori. and vert. boundaries h,v,\n");
  50.                    fprintf(stderr,"            h,v of the form a-b or a+b, a and b integer or float [0.0...1.0]\n");
  51.                    fprintf(stderr,"\n");
  52.  
  53.                    fprintf(stderr," %s  -c0    don't correct (linear).\n", X(C_DEFAULT,C_LINEAR));
  54.                    fprintf(stderr," %s  -c-    correct darker.\n",         X(C_DEFAULT,C_DARK));
  55.                    fprintf(stderr," %s  -c+    correct brighter.\n",       X(C_DEFAULT,C_BRIGHT));
  56.                    fprintf(stderr,"\n");
  57.  
  58.                    fprintf(stderr," %s  -0     Extract thumbnails from Overview file.\n",        X(S_DEFAULT,S_Over));
  59.                    fprintf(stderr," %s  -C d s Extract contact sheet from Overview file, d images width,\n",X(S_DEFAULT,S_Contact)); 
  60.                    fprintf(stderr,"            with contact sheet orientation s ( one of n l r h).\n");
  61.                    fprintf(stderr," %s  -1     Extract  128x192   from Image file.\n",           X(S_DEFAULT,S_Base16));
  62.                    fprintf(stderr," %s  -2     Extract  256x384   from Image file.\n",           X(S_DEFAULT,S_Base4));
  63.                    fprintf(stderr," %s  -3     Extract  512x768   from Image file.\n",           X(S_DEFAULT,S_Base));
  64.                    fprintf(stderr," %s  -4     Extract 1024x1536  from Image file.\n",           X(S_DEFAULT,S_4Base));
  65.                    fprintf(stderr," %s  -5     Extract 2048x3072  from Image file.\n",           X(S_DEFAULT,S_16Base));
  66.                    fprintf(stderr," %s  -6     Extract 4096x6144  from Image file and 64Base-Directory.\n",           X(S_DEFAULT,S_64Base));
  67.                    fprintf(stderr,"\n");
  68. #endif
  69.                    break;
  70.     case E_OPT:    fprintf(stderr,"These Options are not allowed together.\n");break;
  71.     case E_MEM:    fprintf(stderr,"Not enough memory !\n"); break;
  72.     case E_HUFF:   fprintf(stderr,"Error in Huffman-Code-Table\n"); break;
  73.     case E_SEQ:    fprintf(stderr,"Error in Huffman-Sequence, try option -rep\n"); break;
  74.     case E_SEQ1:   fprintf(stderr,"Error1 in Huffman-Sequence, try option -rep\n"); break;
  75.     case E_SEQ2:   fprintf(stderr,"Error2 in Huffman-Sequence, try option -rep\n"); break;
  76.     case E_SEQ3:   fprintf(stderr,"Error3 in Huffman-Sequence, try option -rep\n"); break;
  77.     case E_SEQ4:   fprintf(stderr,"Error4 in Huffman-Sequence, try option -rep\n"); break;
  78.     case E_SEQ5:   fprintf(stderr,"Error5 in Huffman-Sequence, try option -rep\n"); break;
  79.     case E_SEQ6:   fprintf(stderr,"Error6 in Huffman-Sequence, try option -rep\n"); break;
  80.     case E_SEQ7:   fprintf(stderr,"Error7 in Huffman-Sequence, try option -rep\n"); break;
  81.     case E_POS:    fprintf(stderr,"Error in file-position\n"); break;
  82.     case E_OVSKIP: fprintf(stderr,"Can't read this resolution in overskip-mode\n"); break;
  83.     case E_TAUTO:  fprintf(stderr,"Can't determine the orientation in overview mode\n");break;
  84.     case E_SUBR:   fprintf(stderr,"Error in Subrectangle Parameters\n");break;
  85.     case E_PRPAR:  fprintf(stderr,"Bad printing parameters\n");break;
  86.     case E_CONFIG: fprintf(stderr,"Something is wrong with your configuration [see %s:%d]\n",file,line);
  87.                    fprintf(stderr,"Edit the config.h and recompile...\n"); break;
  88.     case E_TCANT:  fprintf(stderr,"Sorry, can't determine orientation for this file.\n");
  89.                    fprintf(stderr,"Please give orientation parameters. \n");break;
  90.     case E_FOPEN:  fprintf(stderr,"Can't open file\n"); break;
  91.     default:       fprintf(stderr,"Unknown error %d ???  [%s:%d]\n",e,file,line);break;
  92.    }
  93.   close_all();
  94.   exit(9);
  95.  }
  96.  
  97.  
  98.